<!DOCTYPE html>
<html>
	<head>
		<title>查询SAP资料信息</title>
		<meta http-equiv="content-type" content="text/html;charset=utf-8">
		<meta name="viewport" content="width=device-width, initial-scale=1.0">
		<!-- <link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css">-->
		<link rel="stylesheet" href="/css/bootstrap.min.css">
		<script src="/js/jquery.min.js"></script>
		<script src="/js/bootstrap.min.js"></script>
	</head>
<body>
<?php
	extract($_POST);
	extract($_GET);
	unset($_POST,$_GET);

	if(isset($wo))
		$wo=trim($wo);

	echo "<div class='container'>";
	echo "<div style='float:left'>";
	echo "	<form action='getbominfo.php?act=q' method='POST' role='form' class='form-inline'>";
	echo "		<div class='form-group'>";
	echo "			<label for='inputSN' class='col-sm-4 form-control'>序号/工单/成品料号</label>";
	if(strlen($wo)<=0){
		echo "			<input type='text' class='form-control' name='wo' id='inputSN' placeholder='请输入序号/工单/成品料号'>";
	}else{
		echo "			<input type='text' class='form-control' name='wo' id='inputSN' value='$wo'>";
	}
	echo "			<button type='submit' class='btn btn-info form-control'>查询</button>";
	echo "		</div>";
	echo "	</form>";
	echo "</div>";
	echo "<br><br>";
	echo "<div>";

	if(strlen($wo)<=6)
		echo "<div><font color='red'>You need to input Work Order</font></div>";
	else if(strstr($wo, "FGM") || strstr($wo, "FBM") || strlen($wo)==7){
		/*echo "<iframe src='http://10.100.160.37:1579/Default?PN=${wo}' height=700 width=100%></iframe>";*/
		$data = file_get_contents("http://10.100.160.37:1579/Default?PN=${wo}");
		echo "<pre>\r\n".trim(str_replace("查PN BOM格式http://10.100.160.37:1579/Default?PN=FBM-GK5MR0O0178PCS,请注意输入法半角及参数大写,参数不加单引号！", "", 
								str_replace("SAP BOM明细", "", 
								str_replace("Home Page", "", strip_tags($data)))))."\r\n</pre>";
	}else if(strstr($wo, "KNTA") || strstr($wo, "KTTA") || strstr($wo, "KMTA")){
		/*echo "<iframe src='http://10.100.160.37:1579/Default?WO=${wo}' height=700 width=100%></iframe>";*/
		$data = file_get_contents("http://10.100.160.37:1579/Default?WO=${wo}");
		echo "<pre>\r\n".trim(str_replace("查PN BOM格式http://10.100.160.37:1579/Default?PN=FBM-GK5MR0O0178PCS,请注意输入法半角及参数大写,参数不加单引号！", "", 
								str_replace("SAP BOM明细", "", 
								str_replace("Home Page", "", strip_tags($data)))))."\r\n</pre>";
	}else{
		/*echo "<iframe src='http://10.100.160.37:1579/Default?SN=${wo}' height=700 width=100%></iframe>";*/
		$data = file_get_contents("http://10.100.160.37:1579/Default?SN=${wo}");
		echo "<pre>\r\n".trim(str_replace("查PN BOM格式http://10.100.160.37:1579/Default?PN=FBM-GK5MR0O0178PCS,请注意输入法半角及参数大写,参数不加单引号！", "", 
								str_replace("SAP BOM明细", "", 
								str_replace("Home Page", "", strip_tags($data)))))."\r\n</pre>";
	}
?>
	</body>
</html>